package com.hd.appcommon.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.hd.appcommon.entity.Major;
import com.hd.appcommon.mapper.MajorMapper;
import com.hd.appcommon.service.MajorService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class MajorServiceImpl extends ServiceImpl<MajorMapper, Major> implements MajorService {

    @Autowired
    MajorMapper majorMapper;
    @Override
    public List<String> getMajors() {
        return majorMapper.getMajors();
    }
    public String getNameByCode(String code){
        QueryWrapper wrapper = new QueryWrapper<>()
                .select("name")
                .eq("code",code);
        return this.getOne(wrapper).getName();
    }

}
